<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>管理后台</title>
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <link href="/favicon.ico" type="image/x-icon" rel="shortcut icon" />
    <!-- Bootstrap 3.3.4 -->
    <link href="/public/admin/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="/public/admin/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="/public/admin/css/animate.css" rel="stylesheet">
    <link href="/public/admin/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
    <link href="/public/admin/css/style.css?v=4.0.0" rel="stylesheet">
    <link href="/public/admin/css/ratuo.css" rel="stylesheet">

    <script src="/public/admin/js/jquery.min.js?v=2.1.4"></script>
    <script src="/public/admin/js/bootstrap.min.js?v=3.3.5"></script>
    <script src="/public/admin/js/common.js"></script>
    <script src="/public/admin/js/plugins/layer/layer.min.js"></script>
    <script src="/public/admin/js/myAjax.js"></script>
    <script src="/public/admin/js/jquery.validate.js"></script>

    <link href="/public/admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <script src="/public/admin/js/plugins/iCheck/icheck.min.js"></script>

    <script src="/public/admin/js/article.js"></script>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>文章列表</h5>
                </div>
                <div class="ibox-content">
                    <div class="row">
                        <div class="col-xs-12">
                            <div class="box">
                                <div class="box-header">
                                    <div class="panel-body">
                                        <form class="form-horizontal form-inline" action="" method="get">
                                            <b>入学检测：</b>
                                            <select class="form-control" name="testingid" style="max-width:150px;">
                                                {foreach name="testingAllList" item="v"}
                                                <option value="{$v.testingid}" {eq name="v.testingid" value="$testing['testingid']"}selected="selected"{/eq}>{$v.testing_name}</option>
                                                {/foreach}
                                            </select>
                                            <button type="submit" style="margin-left:30px" class="btn btn-primary">查询</button>
                                            <a style="margin-left:30px" class="btn btn-primary" href="{:url('Testinglog/daochu',array('testingid'=>$testing['testingid'],'art_type'=>2))}" target="_blank">导出数据表</a>
                                        </form>
                                    </div>
                                </div>
                                <div class="box-body">
                                    <div class="row">
                                        <div class="col-sm-12">
                                            <div id="ajaxList">

                                                <form method="post" enctype="multipart/form-data" id="form-order">
                                                    <table class="table table-bordered table-hover">
                                                        <thead>
                                                        <tr>
                                                            <th style="width: 1px;display:none"><input type="checkbox" onclick="$('input[name*=\'ids\']').prop('checked', this.checked);"></th>
                                                            <!--<th>ID</th>-->
                                                            <th>学号</th>
                                                            <th>语文</th>
                                                            <th>数学</th>
                                                            <th>英语</th>
                                                            <th>物理</th>
                                                            <th>化学</th>
                                                            <th>总分</th>
                                                            <th style="display:none">操作</th>
                                                        </tr>
                                                        </thead>
                                                        <tbody id="ajaxList">
                                                        {if empty($list)}
                                                        <tr>
                                                            <td colspan="7" align="center">暂无数据</td>
                                                        </tr>
                                                        {/if}
                                                        {foreach name="list" item="v" key="k" }
                                                        <tr role="row">
                                                            <td style="display:none"><input type="checkbox" name="ids[]" value="{$v.id}" onclick="attrBg(this)"></td>
                                                            <!--<td>{$v.id}</td>-->
                                                            <td>{$v.user_name}</td>
                                                            <td>{$v.yuwen|default='未考'}</td>
                                                            <td>{$v.shuxue|default='未考'}</td>
                                                            <td>{$v.yingyu|default='未考'}</td>
                                                            <td>{$v.wuli|default='未考'}</td>
                                                            <td>{$v.huaxue|default='未考'}</td>
                                                            <td>{$v.total_score}</td>
                                                            <td style="display:none">
                                                                <a class="btn btn-primary" href="javascript:;" title="编辑" onclick="openYemian('/index.php/Admin/Article/article/act/edit/article_id/{$vo.article_id}','编辑文章内容')"><i class="fa fa-pencil"></i></a>
                                                                <a class="btn btn-danger" href="javascript:void(0)" title="删除" data-url="{:url('Article/aticleHandle')}" data-id="{$vo.article_id}" onclick="delarticle(this,'确定把该文章加入回收站？',{$vo.article_id},'/index.php/Admin/Article/articleReback')"><i class="fa fa-trash-o"></i></a>
                                                            </td>
                                                        </tr>
                                                        {/foreach}
                                                        </tbody>
                                                    </table>
                                                </form>
                                                <div>
                                                    <div style="float:left;display:none"><a href="javascript:void(0);" onclick="reback_select()" id="button-delete6" data-toggle="tooltip" title="删除" class="btn btn-danger" data-original-title="放入回收站">把选中文章放入回收站</a></div>
                                                    <div style="float:right;margin-top:-20px;" id="pagelist">
                                                        <ul class="pagination">
                                                            {$pageList.prev|raw} {$pageList.pageNum|raw} {$pageList.next|raw}
                                                        </ul>
                                                        <span style="float:right;margin:25px">共{$count}条</span>
                                                    </div>
                                                </div>
                                                <script>
                                                    // 点击分页触发的事件
                                                    $(".pagination a").click(function(){
                                                        url = $(this).attr('href');
                                                        ajax_get_table('formSearch',url);
                                                        return false;
                                                    });
                                                    // 删除选中
                                                    function reback_select(){
                                                        parent.layer.confirm('确定把选中文章加入回收站？', function(){
                                                            url = window.location.href;
                                                            $.ajax({
                                                                url:"/index.php/Admin/article/reback_select",
                                                                data : $('#form-order').serialize(),
                                                                success: function(v){
                                                                    var v =  eval('('+v+')');
                                                                    parent.layer.msg(v.message, {icon: v.icon,time: 1000});
                                                                    if(v.hasOwnProperty('status') && (v.status == 1))
                                                                        getAjaxList('ajaxList',1,"/index.php/Admin/Article/ajaxArticleList");
                                                                }
                                                            });
                                                        });
                                                    }

                                                    function attrBg(obj){
                                                        if($(obj).prop('checked')){
                                                            $(obj).closest('tr').addClass('active_bg');
                                                        }else{
                                                            $(obj).closest('tr').removeClass('active_bg');
                                                        }
                                                    }
                                                </script>

                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    function delarticle(obj,name,id,url) {
        top.layer.confirm(name,{
            icon : 3,
            btn:['确定','取消'],
        } , function(){
            $.ajax({
                url : url,
                type : "post",
                data : {article_id:id,act:'del'},
                dataType : "json",
                success:function(data){
                    if (data.status == 0) {
                        top.layer.msg(data.message);
                    } else {
                        top.layer.msg(data.message);
                        $(obj).parent().parent().remove();
                    }
                }
            });
        } , function(){
            layer.close(); //再执行关闭
        })
    }
</script>

</body>

</html>